package org.hoyi.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtils
{
	static SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	static SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");

	public static Date String2Date(String date) throws ParseException
	{
		return sdf1.parse(date);
	}
	public static Date String2DateD(String date) throws ParseException
	{
		return sdf2.parse(date);
	}
	public static String Date2String(Date date)
	{
		return sdf1.format(date);
	}

	public static String Date2String(long time)
	{
		return sdf1.format(time);
	}
	public static String Date2StringD(long time)
	{
		String curTime = sdf2.format(System.currentTimeMillis());
		return curTime;
	}
	public static String getCurTime()
	{
		String curTime = sdf1.format(System.currentTimeMillis());
		return curTime;

	}

	public static String getCurTimeDay()
	{
		String curTime = sdf2.format(System.currentTimeMillis());
		return curTime;
	}

	public static String getLong2String(String datetime)
	{
//		long datetime1 = Long.valueOf(datetime);
		String date = sdf1.format(System.currentTimeMillis() * 1000L);
		return date;
	}
}
